package com.teach;

/**
 * <pre>
 * -
 * Author : J.L.Zhou
 * E-Mail : 2233875735@qq.com
 * Tel : 151 1104 7708
 * Date : 2021-04-09 15:12
 * Version : 1.0
 * Copyright 2021 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 **/
public class Demo09 {
  public static void main(String[] args) {
//    System.out.println(division(10, 1));
    System.out.println(division(10, 0));
  }

  public static int division(int x,int y){
    try{
      System.out.println("x/y="+x/y);
      System.out.println("x/y计算结束");
      return x/y;
    }catch(ArithmeticException e){
      System.out.println("发生了数学异常，注意除数不能为0.");
//      System.exit(0);//唯一不让finally执行的情况
      return 0;
    }finally{
      System.out.println("finally代码块");
    }
  }
}
